Better way to fix bug#70036
authorJoão Távora <joaotavora@gmail.com>
Thu, 18 Apr 2024 13:03:10 +0000 (08:03 -0500)
committerJoão Távora <joaotavora@gmail.com>
Thu, 18 Apr 2024 14:33:32 +0000 (09:33 -0500)
commit3228c1222c99e672ca0cd7599c07ea1db852aa1a
treef7f79414778516a627ae9b122c249d10bd246f20
parent306feb7d967ecea9c916dd6e25b2e84a3f1c714e
Better way to fix bug#70036

Cache a new eglot--cached-tdi var per buffer, which contains value to
return from eglot--TextDocumentIdentifier.

This avoids frequent expensive recomputation of a value that requires
potentially many 'file-truename' calls.  This technique is used in a
number of other cases already, like eglot--recent-changes or
eglot--versioned-identifier.

* lisp/progmodes/eglot.el (eglot--cached-tdi): New variable.
(eglot--TextDocumentIdentifier): Tweak.
(eglot--signal-textDocument/didOpen): Clear eglot--cached-tdi.
lisp/progmodes/eglot.el